currentlimit4 2.2.0
Loading...
Searching...
No Matches
currentlimit4


Current Limit 4 Click

Current Limit 4 Click demo application is developed using the NECTO Studio, ensuring compatibility with mikroSDK's open-source libraries and tools. Designed for plug-and-play implementation and testing, the demo is fully compatible with all development, starter, and mikromedia boards featuring a mikroBUS™ socket.


Click Library

  • Author : Nenad Filipovic
  • Date : Aug 2023.
  • Type : ADC/I2C type

Software Support

Example Description

This library contains API for the Current Limit 4 Click driver for the current limiting to a certain value and displays the sources a current proportional to the load current [A].

Example Libraries

  • MikroSDK.Board
  • MikroSDK.Log
  • Click.CurrentLimit4

Example Key Functions

Application Init

Initialization of I2C and ADC module and log UART. After driver initialization, the app executes a default configuration and set the minimum current limit threshold to 1.0 [A].

void application_init ( void )
{
log_cfg_t log_cfg;
currentlimit4_cfg_t currentlimit4_cfg;
LOG_MAP_USB_UART( log_cfg );
log_init( &logger, &log_cfg );
log_info( &logger, " Application Init " );
// Click initialization.
currentlimit4_cfg_setup( &currentlimit4_cfg );
CURRENTLIMIT4_MAP_MIKROBUS( currentlimit4_cfg, MIKROBUS_1 );
err_t init_flag = currentlimit4_init( &currentlimit4, &currentlimit4_cfg );
if ( ( ADC_ERROR == init_flag ) || ( I2C_MASTER_ERROR == init_flag ) )
{
log_error( &logger, " Communication init." );
for ( ; ; );
}
if ( CURRENTLIMIT4_ERROR == currentlimit4_default_cfg ( &currentlimit4 ) )
{
log_error( &logger, " Default configuration." );
for ( ; ; );
}
log_info( &logger, " Application Task " );
Delay_ms ( 100 );
}
@ CURRENTLIMIT4_ERROR
Definition currentlimit4.h:208
#define CURRENTLIMIT4_MAP_MIKROBUS(cfg, mikrobus)
MikroBUS pin mapping.
Definition currentlimit4.h:142
void application_init(void)
Definition main.c:34

Application Task

This example demonstrates the use of the Current Limit 4 Click board™. The demo application displays the source current proportional to the load current and an appropriate message when the current reaches the limit. Results are being sent to the UART Terminal, where you can track their changes.

void application_task ( void )
{
static float current = 0;
if ( CURRENTLIMIT4_OK == currentlimit4_get_current( &currentlimit4, &current ) )
{
{
log_printf( &logger, " Current : %.3f [A]\r\n", current );
}
else
{
log_printf( &logger, " Input voltage is lower then undervoltage protection threshold.\r\n" );
}
Delay_ms ( 1000 );
}
}
@ CURRENTLIMIT4_OK
Definition currentlimit4.h:207
#define CURRENTLIMIT4_POWER_GOOD
Current Limit 4 power good indication states.
Definition currentlimit4.h:116
void application_task(void)
Definition main.c:72

Application Output

This Click board can be interfaced and monitored in two ways:

  • Application Output - Use the "Application Output" window in Debug mode for real-time data monitoring. Set it up properly by following this tutorial.
  • UART Terminal - Monitor data via the UART Terminal using a USB to UART converter. For detailed instructions, check out this tutorial.

Additional Notes and Information

The complete application code and a ready-to-use project are available through the NECTO Studio Package Manager for direct installation in the NECTO Studio. The application code can also be found on the MIKROE GitHub account.